﻿/* Copyright 2010 Imaginary Development. All rights reserved*/
function Display(index, entry) {
    var tBody = $("table#types tbody");
    var content = entry.content.$t;
    var attributes = "";
    var ore = (/ore: ([0-9]+)/).exec(content)[1];
    var crystal = (/crystal: ([0-9]+)/).exec(content)[1];
    var hydro = (/hydro: ([0-9]+)/).exec(content)[1];
    var debris = (/producesdebris: ([0-1])/).exec(content)[1];
    attributes += "ore='" + ore + "' ";
    attributes += "crystal='" + crystal + "' ";
    attributes += "hydro='" + hydro + "' ";
    attributes += "debris='" + debris + "' ";
    var attacker = 1 == debris ? "<input type='text' size='3' id='" + entry.title.$t.replace(" ", "") + "A' />" : "";
    var tr = "<tr " + attributes + "><td>" + entry.title.$t + "</td><td class='attacker'>" + attacker +
       "</td><td class='defender'><input type='text' size='3' id='" + entry.title.$t.replace(" ", "") + "D' /></td></tr>";
    tBody.append(tr); //attacker

}
function CallbackFunc(data) {
    $("#status").text("callback");
    //var entries = $("entry", data.feed)
    var entries = data.feed.entry;
    $.each(entries, Display);
    $("#status").text("Display Initialized");
}
  